﻿using Sidewinder.Core.Interfaces.Entities;
using Wolfpack.Core.Configuration;
using Wolfpack.Core.Interfaces.Entities;
using Wolfpack.Core;
using Wolfpack.Core.Notification.Filters.Request;

namespace Wolfpack.Contrib.Deployment.Exe
{
    public class ExecuteDeploymentPublisherConfigurationDiscovery : PluginDiscoveryBase<ExecuteDeploymentConfig, ExecuteDeploymentPublisher>
    {
        protected override ExecuteDeploymentConfig GetConfiguration()
        {
            return new ExecuteDeploymentConfig
                       {
                           Args = "",
                           Command = "notepad.exe",
                           ConflictResolution = ConflictResolutionTypes.Overwrite,
                           DownloadFolder = @"_deploy\demo",
                           Enabled = true,
                           Feed = "http://www.myget.org/F/wolfpack/",
                           FriendlyId = "CHANGEME!",
                           NotificationMode = AlwaysPublishNotificationFilter.FilterName,
                           PackageId = "Wolfpack.Contrib.Demo",
                           TargetHealthCheckName = "The FriendlyId of the trigger NuGetRelease check",

                           Domain = "",
                           UserName = "",
                           Password = ""
                       };
        }

        protected override void Configure(ConfigurationEntry entry)
        {
            entry.Name = "ExecuteDeploymentPublisher";
            entry.Link = "http://wolfpackcontrib.codeplex.com";
            entry.Description = "This publish reacts to a trigger message (usually from the NuGet check) and will " +
                "download the updated NuGet package, unpack it and execute the command line you have configured; A notification " + 
                "will be generated to inform you of the result (exitcode) returned from the executable";
            entry.Tags.AddIfMissing(SpecialTags.PUBLISHER, "Deployment");
        }
    }
}